package com.jsbs.iam.job.dyncjob.task;

import com.jsbs.iam.common.core.dto.Result;
import com.jsbs.iam.job.dyncjob.task.base.BaseTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

@Component
public class SampleJobTask extends BaseTask implements InitializingBean {

    private static Logger LOGGER = LoggerFactory.getLogger(SampleJobTask.class);


    @Override
    protected Result doTask(String param) {
        //do something here
        LOGGER.info(param);
        LOGGER.info("SampleJobTask executed");
//        if(1 == 1){
//            throw new RuntimeException("dddd");
//        }
        return Result.success();
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        register("TEST");
    }
}
